package com.rui.composite.model;

import com.rui.composite.obj.MenuComponent;

/**
 * @Description: 子菜单类
 * @Author: ZhangRui
 * @Date: 2023/3/3 11:01
 * @Version: 1.0
 */
public class MenuItem extends MenuComponent {

    public MenuItem(String name, int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i = 1; i < level; i++) {
            System.out.print("--");
        }
        System.out.println(name);
    }
}
